<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>P138 6.3.3 【案例】定时跳转</title>
</head>

<body>
    <div>
        <h2>提交成功</h2>
        <a href="http://www.example.com">
            <span id="seconds">3</span>秒后系统会自动跳转，也可单击此链接跳转
        </a>
        <script>
            function timing(secs, url) {
                var seconds = document.getElementById('seconds');
                seconds.innerHTML = --secs;
                if (secs > 0) {
                    setTimeout('timing(' + secs + ',\'' + url + '\')', 1000);
                } else {
                    location.href = url;
                }
            };
            timing(3, 'http://www.example.com');
        </script>
        <a href="../首页/page06.html">
            <h2>返回上一页面</h2>
        </a>
</body>

</html>